﻿@using Qcy.Jshj.Web.Helpers;
@using Webdiyer.WebControls.Mvc;
@model Qcy.Jshj.Web.Models.ProductsModel
@{
    ViewBag.Title = Model.Category.Title;
}
<link href="~/Scripts/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" />
<script src="~/Scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
<script>
    $(function () {
        $("a[rel=product]").fancybox({
            'transitionIn': 'none',
            'transitionOut': 'none',
            'titlePosition': 'over',
            'titleFormat': function (title, currentArray, currentIndex, currentOpts) {
                var thisFancy = currentArray[currentIndex];
                return '<span id="fancybox-title-over">' + title + '<br/>' + thisFancy.rev + '</span>';
            }
        });
        $(".news_left_nav a").click(function () {
            var sub = $(this).parent().find(".sub");
            if (sub.length > 0) {
                sub.toggle('slow');
                return false;
            }
            return true;
        });
    });
</script>

<div class="news_banner">
    <img src="/Content/images/news_banner.jpg" width="990" height="268" alt="" />
</div>
<div class="news_left">
    <div class="news_left_title">
        <span class="en">PRODUCTS</span>
        <span class="cn">产品展示</span>
    </div>
    <ul class="news_left_nav">
        @foreach (var item in DataHelper.GetProductCategories())
        {
            var subCategories = DataHelper.GetProductCategories(item.Id);
            if (Model.Category.Id == item.Id)
            {
            <text>
            <li class="select"><a href="/Home/Products/@item.Id" >@item.Title</a>
                @if (subCategories != null && subCategories.Count() > 0)
                {
                    <ul class="sub">
                        @foreach (var sub in subCategories)
                        {
                            if (Model.SubCategory != null && Model.SubCategory.Id == sub.Id)
                            {
                            <text>
                            <li class="select"><a href="/Home/Products/@item.Id?cate=@sub.Id" >@sub.Title</a>
                            </li>
                            </text>
                            }
                            else
                            {
                            <text>
                            <li><a href="/Home/Products/@item.Id?cate=@sub.Id" >@sub.Title</a></li>
                            </text>
                            }
                        }
                    </ul>
                }
            </li>
            </text>
            }
            else
            {
            <text>
            <li><a href="/Home/Products/@item.Id">@item.Title</a>
                @if (subCategories != null && subCategories.Count() > 0)
                {
                    <ul class="sub">
                        @foreach (var sub in subCategories)
                        {
                            <li><a href="/Home/Products/@item.Id?cate=@sub.Id" >@sub.Title</a></li>   
                        }
                    </ul>
                }
            </li>
            </text>
            }
        }
    </ul>
    <img class="b_logo" src="/Content/images/b_logo.gif" alt="@ApplicationTag.GetTag("jiashijia")" />
</div>
<div class="news_right">
    <div class="news_right_nav">
        <a>@ApplicationTag.GetTag("Location")</a> > <span>@Model.Category.Title</span>
    </div>
    <div class="news_right_sub_nav">
        <a class="title"><strong>@Model.Category.Title</strong></a>
        <p class="r_s_nav">
            @foreach (var item in Model.SubCategories)
            {
                if (Model.SubCategory != null && Model.SubCategory.Id == item.Id)
                {
                <text>
                <a class="selected" href="/Home/Products/@Model.Category.Id?cate=@item.Id">@item.Title</a>
                </text>
                }
                else
                {
                <text>
                <a href="/Home/Products/@Model.Category.Id?cate=@item.Id">@item.Title</a>
                </text>
                }
            }
        </p>
    </div>
    <div class="category_description">
        @Model.Category.Contents
    </div>
    <ul class="product_list">
        @if (Model.Products != null)
        {
            foreach (var item in Model.Products)
            {
            <text>
            <li>
                <a rel="product" class="product_pic" href="@item.Image" title="@item.Title" rev="@item.Contents">
                    <img src="@item.Image" alt="@item.Title" />
                </a>
                <p>@item.Title</p>
            </li>
            </text>
            }
        }
    </ul>
    <div class="clear"></div>
    <div class="pager">
        @Html.Pager(Model.Products,
        new PagerOptions()
        {
            CssClass = "pages",
            PageIndexParameterName = "page",
            AutoHide = false,
            ShowFirstLast = false,
            PrevPageText = "上一页",
            NextPageText = "下一页",
            ShowPrevNext = true,
            AlwaysShowFirstLastPageNumber = true,
            NumericPagerItemCount = 4,
            CurrentPagerItemWrapperFormatString = "<span class=\"cpb\">{0}</span>",
            NumericPagerItemWrapperFormatString = "<span class=\"item\">{0}</span>",
        })
    </div>
    <div class="page" style="display: none;">
        <div class="page_left">
            <a href="#">
                <img src="images/pre_page.gif" alt="" /></a>
            <a class="select" href="#">1</a>
            <a href="#">2</a>
            <a href="#">3</a>
            <a href="#">
                <img src="images/next_page.gif" alt="" /></a>
        </div>
        <div class="page_right">
            <span class="go_span">跳转到：</span>
            <input type="text" class="go_txt" />
            <input type="button" class="go_btn" />
        </div>
    </div>
</div>
